<template>
	<view class="page page-image">
		<up-navbar placeholder bgColor="transparent">
			<template #left>
				<view />
			</template>
			<template #center>
				<view class="text-700-132">找工作</view>
			</template>
		</up-navbar>
		<noticeBar></noticeBar>
		<view class="p-h30">
			<SearchView @search="handleInputChange" />
			<!-- <FilterView @change="handleChange" /> -->
			<OfficeView :list="positionList" />
			<up-empty mode="list" text="暂无数据" v-if="!positionList.length"></up-empty>
		</view>
	</view>
</template>

<script lang="ts" setup>
import SearchView from "./components/search.vue";
import FilterView from "./components/filter.vue";
import OfficeView from "./components/office.vue";
import { ref, reactive } from "vue";
import { onShow, onReachBottom } from "@dcloudio/uni-app";
const form = reactive({ page: 1, limit: 10, title: "" });
const positionList = ref([]);
const getPositionList = () => {
	uni.$u.get("/position/lst", form).then((res) => {
		if (res.code === 1) {
			positionList.value = positionList.value.concat(res.data.data);
		}
	});
};
function handleInputChange(value) {
	handleChange(value);
}
function handleChange(title) {
	form.title = title;
	form.page = 1;
	positionList.value = [];
	getPositionList();
}
getPositionList();
onReachBottom(() => {
	form.page += 1;
	getPositionList();
	console.log("触底了");
});
</script>

<style lang="scss" scoped>
.page {
	background-color: $page-color-1;
}
</style>
